package com.dingding.service.activity.core.sql;

/**
 * @ClassName: IntegralActivitySQL
 * @Description: 积分优惠活动操作SQL
 * @author yuHaiQing
 * @date 2016年4月11日 上午11:51:39
 */
public class IntegralActivitySQL {
	
	/**
	 * 重置无效的活动状态
	 * 
	 * @author YHQ
	 */
	public static final String RESET_INVALID_INTEGRAL_ACTIVITY = "UPDATE integralactivity SET activityStatus = 2 WHERE TO_DAYS(NOW()) - TO_DAYS(activityEndDate) > 0";

	/**
	 * 重置活动限制次数
	 * 
	 * @author YHQ
	 */
	public static final String RESET_ACTIVITY_LIMIT_NUMBER = "UPDATE activityreluser SET drawNumber = 0 WHERE activityreluser.activityId IN (SELECT integralActivityId FROM integralactivity i WHERE i.activityStatus = 1 AND i.isFrequencyLimit = 2 AND i.limitFailureType = 1) AND activityreluser.activityType = 1";
	
}
